package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author lilh
 * @date 2019-08-19 10:42
 */
public enum CommonOperateLogEnum {

    /**
     *
     */
    CREATE_PROCESS_INSTANCE("createProcessInstance", "创建流程实例"),

    START_PROCESS_INSTANCE("startProcessInstance", "启动流程实例"),

    COMPLETE_WORK_ITEM("completeWorkItem", "完成工作项"),

    TERMINATE_PROCESS("terminateProcessInstance", "结束流程实例"),

    CREATE_WORK_ITEM("createWorkOrder", "回调创建工作项"),

    COMPLETE_PROCESS_INSTANCE("reportProcessState", "完成流程实例"),

    SET_PARTICIPANT("setParticipants", "设置参与人"),

    TASK_ROLLBACK("taskRollback", "回退"),

    NOTICE_SETTING("taskNoticeSetting", "通知设置"),

    HANDLE_TASK("handleTask", "办理任务"),

    START_APPLICATION("startApplication", "发起申请"),

    END("END", "终止"),

    PAUSE("PAUSE", "暂停"),

    UNPAUSE("UNPAUSE", "解挂"),

    RECALL("RECALL", "撤销");


    private String code;

    private String desc;

    private static Map<String, String> codeToDescriptionMap;

    static {
        codeToDescriptionMap = Arrays.stream(values()).collect(Collectors.toMap(CommonOperateLogEnum::getCode, CommonOperateLogEnum::getDesc));
    }

    CommonOperateLogEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescription(String code) {
        return codeToDescriptionMap.get(code);
    }
}
